package cn.com.zero.manager.auth.controller;

import cn.com.zero.api.log.annotation.Log;
import cn.com.zero.base.vo.ResponseVO;
import cn.com.zero.manager.auth.constant.LogType;
import cn.com.zero.manager.auth.vo.OnLineCustomerVO;
import cn.com.zero.web.controller.BaseController;
import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Huangyong
 * @version 1.0.0
 * @Description
 * @createTime 2020/1/16 9:17
 */
@Api(tags = "在线客户管理接口")
@Validated
@RestController
@RequestMapping("/customer/customerOnline")
public class CustomerOnlineController extends BaseController {

    @ApiOperation("查询在线用户")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "userId", value = "用户编号"),
            @ApiImplicitParam(paramType = "query", name = "nickname", value = "昵称"),
            @ApiImplicitParam(paramType = "query", name = "showMobilePhone", value = "手机号"),
            @ApiImplicitParam(paramType = "query", name = "beginCreateTime", value = "注册时间段开始;格式:yyyy-MM-dd"),
            @ApiImplicitParam(paramType = "query", name = "endCreateTime", value = "注册时间段结束;格式:yyyy-MM-dd"),
            @ApiImplicitParam(paramType = "query", name = "onlineTime", value = "在线时间长;0：10分钟以内；1：10-30分钟 2:30分钟以上")
    })
    @GetMapping("/list")
    public List<OnLineCustomerVO> queryOnlineCustomer(@RequestParam(value = "userId", required = false) Long userId
            , @RequestParam(value = "nickname", required = false) String nickname
            , @RequestParam(value = "showMobilePhone", required = false) String showMobilePhone
            , @RequestParam(value = "beginCreateTime", required = false) String beginCreateTime
            , @RequestParam(value = "endCreateTime", required = false) String endCreateTime
            , @RequestParam(value = "onlineTime", required = false) Integer onlineTime) {

        return null;
    }

    @Log(content = "下线用户", logType = LogType.LOG_MANAGE)
    @ApiOperation(value = "下线用户")
    @ApiImplicitParam(paramType = "path", name = "userId", value = "用户Id，当传入用户Id未登录时返回 false，已登录，且强制下线成功返回 true")
    @ApiResponse(code = 200, message = "返回boolean true 成功 false 失败")
    @PostMapping("/kickoff/{userId}")
    public ResponseVO kickoff(@PathVariable("userId") Long userId) {
        ResponseVO result = new ResponseVO();
        return result;
    }
}
